package com.yl.auth.service.impl;

import cn.hutool.log.Log;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yl.auth.mapper.JigouzhongxinduanaccountMapper;
import com.yl.auth.entity.Jigouzhongxinduanaccount;
import com.yl.auth.service.JigouzhongxinduanaccountService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author L
 * @since 2023-07-20
 */
@Service
public class JigouzhongxinduanaccountServiceImpl extends ServiceImpl<JigouzhongxinduanaccountMapper, Jigouzhongxinduanaccount> implements JigouzhongxinduanaccountService {
    private static final Log LOG = Log.get();
    @Resource
    private JigouzhongxinduanaccountMapper jigouzhongxinduanaccountMapper;
    @Override
    public void saveAccount(Long id, List<Long> idList) {
        for (Long roleId : idList) {
            jigouzhongxinduanaccountMapper.saveAccountRole(id,roleId);
        }
    }

    @Override
    public Page<Jigouzhongxinduanaccount> findAllAndPage(Page<Jigouzhongxinduanaccount> page1) {
        return jigouzhongxinduanaccountMapper.findAllAndPage(page1);
    }

    @Override
    public List<Long> getRoleByAccount(Long id) {
        return jigouzhongxinduanaccountMapper.getRoleByAccount(id);
    }

    @Override
    public void deleteByRoleId(Long id) {
        jigouzhongxinduanaccountMapper.deleteByRoleId(id);
    }


    @Override
    public String getRoleName(Long id) {
        return jigouzhongxinduanaccountMapper.getRoleName(id);
    }
}
